package com.godyao.mall.seckill.quartz;

import com.godyao.mall.rabbitmq.service.ISendMsgService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author godyao
 * @date 2022/4/4
 */
@Component
@RequiredArgsConstructor
public class MsgQuartz {

    private final ISendMsgService sendMsgService;

    /**
     * 定时扫描失败的消息重发消息
     * 每两分钟执行一次
     */
    @Async
    @Scheduled(cron = "0 0/2 * * * ? ")
    public void resendMsg() {
        sendMsgService.reSendMsg();
    }
}
